﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ChatService
{
    public class MessageDTO
    {
        public int MessageID { get; set; }
        public string Body { get; set; }
        public int ChannelID { get; set; }
        public DateTime Date { get; set; }

        public static MessageDTO CreateFromMessage(Message message)
        {
            MessageDTO messageDTO = new MessageDTO();
            messageDTO.MessageID = message.MessageID;
            messageDTO.Body = message.Body;
            messageDTO.ChannelID = message.ChannelID;
            messageDTO.Date = message.Date;

            return messageDTO;
        }

        public Message ToMessage()
        {
            Message message = new Message();
            message.MessageID = this.MessageID;
            message.Body = this.Body;
            message.ChannelID = this.ChannelID;
            message.Date = this.Date;

            return message;
        }
    }
}